import React, { Component } from 'react'
import News from './News'
import Message from './Message'
import { NavLink, Route, Switch,Redirect } from 'react-router-dom'
export default class Home extends Component {
  render() {
    return (
      <div>
      <h2>Home组件内容</h2>
      <div>
        <ul className="nav nav-tabs">
          <li>
          <NavLink className="list-group-item" to='/home/news'>News</NavLink>
          </li>
          <li>
          <NavLink className="list-group-item" to='/home/message'>Message</NavLink>
          </li>
        </ul>
        <Switch>
					{/* exact 开启严格匹配 严格匹配不要随便开启，需要再开，有些时候开启会导致无法继续匹配二级路由 */}
					<Route path='/home/news'  component={News}></Route>
					<Route path='/home/message' component={Message}></Route>
					{/* Redirect 一般写在所有路由注册的最下方，当所有路由都无法匹配时，跳转到Redirect指定的路由 */}
					<Redirect to='/home/news'></Redirect> 
					</Switch>
      </div>
    </div>
    )
  }
}
